<?php
/**
 * Author:   tangxiaowen
 * Email:    846506584@qq.com
 * Date:     2019/3/13 0013
 * Describe: 基础继承类
 */
namespace app\api\controller;
use think\Controller;
use think\Request;
use think\Log;

class Base extends Controller
{
    public function __construct()
    {
        parent::__construct();
        //初始化本模块下所有日志存放目录
        $this->initLogSavePath();
    }

    /**
     * 初始化本模块下所有日志存放目录
     */
    private function initLogSavePath()
    {
        $requestName = Request::instance()->module();
        $controllerName = Request::instance()->controller();
        $setPath = strtolower("{$requestName}/{$controllerName}/");
        Log::init(['path'=>LOG_PATH.$setPath,'type'  => 'file',]);
    }
}